package net.system.sys.dao.impl;

import static org.junit.Assert.*;

import java.util.Map;
import java.util.List;

import net.system.base.bean.SSysuser;
import net.system.sys.dao.CSystemDAO;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath*:resources/applicationContext*.xml")
public class CSystemDAOImplTest extends AbstractJUnit4SpringContextTests{
	@Autowired
	private CSystemDAO dao;
	@Before
	public void setUp() throws Exception {
	}

	@Test
	public void testSelectUserById() {
		String userId="user_01";
		SSysuser user = dao.selectUserById(userId);
		assertEquals(userId,user.getSuUser());
		assertEquals("user_name",user.getSuName());
	}
	
	@Test
	public void testSelectModuleByRole() {
		String type="0";
		List<Map> user = dao.selectModuleByRole(type);
		assertNotNull(user);// 无效，均为真
		assertTrue(user.size()>0); // 有数据，size>0
		//assertEquals(1,user.size());
		System.out.println(user.get(0).toString());
	}

}
